import java.io.*;
/**
 *
 * @author Alex
 */
public class TestSortedList {

    public static void main(String[] args) {
        SortedList slist = new SortedList(5);
        String res = "";

        try{
            // Open the file that is the first
            // command line parameter
            FileInputStream fstream = new FileInputStream("/Users/Alex/NetBeansProjects/Opdracht1/src/input");
            // Get the object of DataInputStream
            DataInputStream in = new DataInputStream(fstream);
            BufferedReader br = new BufferedReader(new InputStreamReader(in));
            String strLine;
            //Read File Line By Line
            while ((strLine = br.readLine()) != null)   {
                //add the contents of the textfile to the list and build a string
                //with all the numbers
                slist.add(Integer.parseInt(strLine));
                res += strLine + " ";
            }
            //Close the input stream
            in.close();
        }
        catch (Exception e){//Catch exception if any
              System.err.println("Error: " + e.getMessage());
        }

        System.out.print("The following integers have been added to the list: ");
        System.out.println(res);

        System.out.print("Contents of the list: ");
        System.out.println(slist.toString());

        System.out.println("Position of the number 12: " + slist.indexOf(12));
        System.out.println("Position of the number 18: " + slist.indexOf(18));

        slist.remove(3);
        System.out.println("Number 3 is removed");
        System.out.println(slist.toString());
    }

}